home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 February / macpower199702.bin / AMUG / Programming_7 / LogoMation 1.1.3.sit / LogoMation 1.1.3 ƒ / Examples / CS110B Fractal / CS110B Fractal
Encoding:
Text File  |  1996-10-25  |  766 b   |  37 lines  |  [UVtx/UVtl]

  1. // LogoMation is used in Yale University's CS110B course.
  2. // This program demonstrates a fractal.  Many thanks for
  3. // the course teacher, Prof. Lenore D. Zuck, for her kind
  4. // permission to include the program in this release (Ed.)
  5.  
  6. unit = 225
  7. x1 = -100
  8. y1 = -65
  9. prec = 6
  10. Clear 65535,65435,52609
  11.  
  12. Up
  13. Goto x1,y1,0
  14. Down
  15. fractal(unit,prec)
  16.  
  17. ////////////////////////////////////////
  18.  
  19. Function fractal(unit,prec)
  20.     Fill 2,65535,23270,4813
  21.         Repeat 3
  22.             tri_line(unit,prec)
  23.             Left 120
  24.  
  25. Function tri_line(unit,prec)
  26.     If unit < prec
  27.         Forward unit
  28.     Else
  29.                 unit = unit/3
  30.                 tri_line(unit,prec)    
  31.                 Right 60
  32.                 tri_line(unit,prec)    
  33.                 Left 120
  34.                 tri_line(unit,prec)    
  35.                 Right 60
  36.                 tri_line(unit,prec)    
  37.